<!--装配设备管理-->

<template>
  <div style="margin: 0;padding: 0">
    <el-container>
      <!--页面表头设计-->
      <el-header style="height: 7vh">
        <el-link class="headMain" href="http://10.255.96.48:3404/">俄动力质量管理系统</el-link>
        <span class="center-text">{{pageVal.sector}}</span>
        <el-popover
            placement="top-start"
            title="用户信息"
            width="200"
            trigger="hover">
          <div style="margin-top: 10px">Name：{{useName}}</div>
          <div style="margin-top: 10px">ID:{{useId}}</div>
          <div style="margin-top: 10px" @click="logOut"><el-link>退出</el-link></div>
          <div class="headMain" slot="reference">{{useName}}</div>
        </el-popover>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <el-input
              placeholder="输入关键字进行过滤"
              v-model="filterText"
              style="width: 160px">
          </el-input>
          <el-tree
              style="margin: 10px 8px;"
              :data="treeList"
              :props="defaultProps"
              default-expand-all
              @node-click="treeClick"
              :filter-node-method="filterNode"
              ref="tree"
              highlight-current></el-tree>
        </el-aside>
        <el-container>
          <!--主题设计-->
          <el-main style="height: 79vh;overflow: auto">
            <el-tabs v-model="activeName" @tab-click="handleClick">
              <el-tab-pane :label="pageVal.tabs1" name="first">
                <div style="text-align: right">
                  <el-link @click="equipmentListEdit(2,null)" style="color: red;margin-bottom: 5px">插入一条</el-link>
                </div>
                <el-table
                    :data="equipmentList"
                    border
                    style="width: 100%">
                  <el-table-column
                      type="expand">
                    <template v-slot:default="scope">
                      <el-form label-position="left" style="margin-left: 20px">
                        <el-form-item label="加油点管理：">
                          <span>{{scope.row.oil}}</span>
                        </el-form-item>
                      </el-form>
                    </template>
                  </el-table-column>
                  <el-table-column
                      prop="equipmentName"
                      label="设备名称">
                  </el-table-column>
                  <el-table-column
                      prop="equipmentType"
                      label="设备型号">
                  </el-table-column>
                  <el-table-column
                      prop="equipmentItem"
                      label="设备类别"
                      v-slot:default="scope">
                    <span v-if="languageS==='chinese'">{{scope.row.equipmentItem.split('/')[0]}}</span>
                    <span v-if="languageS==='english'">{{scope.row.equipmentItem.split('/')[1]}}</span>
                    <span v-if="languageS==='russian'">{{scope.row.equipmentItem.split('/')[2]}}</span>
                  </el-table-column>
                  <el-table-column
                      prop="equipmentId"
                      label="设备编号">
                  </el-table-column>
                  <el-table-column
                      prop="modelId"
                      label="应用机型">
                  </el-table-column>
                  <el-table-column
                      prop="faultHistory"
                      label="设备故障履历"
                  v-slot:default="scope">
                    <span v-if="scope.row.faultHistory===''">无记录</span>
                    <span v-else>有记录</span>
                    <el-link style="margin-left: 10px" @click="faultHistoryShow(scope)"><i class="el-icon-map-location"></i></el-link>
                  </el-table-column>
                  <el-table-column
                      prop="maintenance"
                      label="设备维修履历"
                      v-slot:default="scope">
                    <span v-if="scope.row.maintenance===''">无记录</span>
                    <span v-else>有记录</span>
                    <el-link style="margin-left: 10px" @click="maintenanceShow(scope)"><i class="el-icon-map-location"></i></el-link>
                  </el-table-column>
                  <el-table-column
                      label="编辑"
                      v-slot:default="scope">
                    <el-link style="margin-right: 10px" @click="equipmentListEdit(1,scope)">编辑</el-link>
                    <el-link @click="equipmentListEdit(3,scope)">删除</el-link>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane :label="pageVal.tabs2" name="second"></el-tab-pane>
              <el-tab-pane label="紧固点管理" name="third"></el-tab-pane>
              <el-tab-pane label="精度校准管理" name="fourth"></el-tab-pane>
              <el-tab-pane label="电气件管理" name="fifth"></el-tab-pane>
              <el-tab-pane label="趋势查询" name="sixth">
                <div style="display: flex;margin-left: 10px;margin-right: 10px;height:34vh;overflow: auto">
                  <div style="flex: 1;  border: 1px solid blue; margin-right: 10px">
                  </div>
                  <div style=" border: 1px solid blue; width: 200px; margin-right: 10px">
                    <div>
                      cpk
                    </div>
                  </div>
                  <div style="width: 150px; border: 1px solid blue;">
                    <div style="margin-top: 8px">
                      <el-button style="width: 130px">25组数据</el-button>
                    </div>
                    <div style="margin-top: 8px">
                      <el-button style="width: 130px">50组数据</el-button>
                    </div>
                    <div style="margin-top: 8px">
                      <el-button style="width: 130px">125组数据</el-button>
                    </div>
                    <div style="margin-top: 8px">
                      <el-button style="width: 130px">500组数据</el-button>
                    </div>
                  </div>
                </div>
                <div style="display: flex;margin-left: 10px;margin-right: 10px;margin-top:10px;height:33vh;overflow: auto">
                  <div style="flex: 1;  border: 1px solid blue; margin-right: 10px">
                  </div>
                  <div style="flex: 1;  border: 1px solid blue; margin-right: 10px">
                  </div>
                  <div style="width: 360px; border: 1px solid blue;">
                  </div>
                </div>
              </el-tab-pane>
              <el-tab-pane label="管理中台" name="seventh">管理中台</el-tab-pane>
              <el-tab-pane label="模型说明" name="eighth">模型说明</el-tab-pane>
              <el-tab-pane label="一级计划" name="ninth"></el-tab-pane>
              <el-tab-pane label="二级计划" name="tenth"></el-tab-pane>

            </el-tabs>
          </el-main>
          <el-footer>
            <el-button plain size="small" @click="chooseLanguage('chinese')">中  文</el-button>
            <el-button plain size="small" @click="chooseLanguage('russian')">Русский язык</el-button>
            <el-button plain size="small" @click="chooseLanguage('english')">English</el-button>
          </el-footer>
        </el-container>
      </el-container>
    </el-container>

    <!--弹窗放置区-->
    <el-dialog
        :title="titleUse"
        :visible.sync="equipmentListDialog"
        width="650px"
        :before-close="handleClose">
      <el-form ref="equipmentTechnologyForm" status-icon :model="equipmentListForm"  label-width="120px">
        <el-form-item label="设备信息：">
          <el-input v-model="equipmentListForm.equipmentName" placeholder="请输入设备名称" style="margin-bottom: 5px"></el-input>
          <el-input v-model="equipmentListForm.equipmentType" placeholder="请输入设备型号" style="margin-bottom: 5px"></el-input>
          <el-input v-model="equipmentListForm.equipmentId" placeholder="请输入设备编号" style="margin-bottom: 5px"></el-input>
        </el-form-item>
        <el-form-item label="附加信息：">
          <el-select v-model="equipmentListForm.equipmentItem" clearable placeholder="请选择设备类别" style="width: 240px;margin-right: 10px">
            <el-option
                v-for="item in equipmentItemOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value">
            </el-option>
          </el-select>
          <el-select v-model="equipmentListForm.modelId" clearable placeholder="请选择设备类别" style="width: 240px">
            <el-option
                v-for="item in modelIdOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="提交结果：">
          <el-button type="primary" @click="equipmentListRowClick">确定</el-button>
          <el-button @click="equipmentListDialog=false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!--弹窗显示设备故障履历的列表-->
    <el-dialog
        :title="titleUse"
        :visible.sync="faultHistoryDialog"
        width="850px"
        :before-close="handleClose">
      <div style="text-align: right">
        <el-link v-if="faultHistoryList.length===0" style="margin-bottom: 10px;color: red" @click="faultHistoryEdit(1,null)">新建</el-link>
      </div>
      <el-table
          :data="faultHistoryList"
          style="width: 100%"
          stripe
          border>
        <el-table-column
            type="expand"
            v-slot:default="scope">
          <el-form ref="faultHistoryForm" status-icon :model="faultHistoryList"  label-width="100px">
            <el-form-item label="原因分析：">
              <div>{{scope.row.reason}}</div>
            </el-form-item>
            <el-form-item label="整改对策：">
              <div>{{scope.row.method}}</div>
              <div>
                <span>完成时间：{{scope.row.metEndTime}}</span>
                <el-divider direction="vertical"></el-divider>
                <span>责任人：{{scope.row.metPer}}</span>
                <el-divider direction="vertical"></el-divider>
                <span>编辑时间：{{scope.row.editTime}}</span>
              </div>
            </el-form-item>
            <el-form-item label="横展内容：">
              <div>{{scope.row.extend}}</div>
              <div>
                <span>完成时间：{{scope.row.extDate}}</span>
                <el-divider direction="vertical"></el-divider>
                <span>责任人：{{scope.row.extPer}}</span>
                <el-divider direction="vertical"></el-divider>
                <span>编辑时间：{{scope.row.editTime}}</span>
              </div>
            </el-form-item>
          </el-form>
        </el-table-column>
        <el-table-column
            label="故障描述"
            prop="describe"
            width="220px">
        </el-table-column>
        <el-table-column
            label="故障日期"
            prop="date"
            width="100px">
        </el-table-column>
        <el-table-column
            label="故障时间"
            prop="time"
            width="80px">
        </el-table-column>
        <el-table-column
            label="故障次数"
            prop="number"
            width="80px">
        </el-table-column>
        <el-table-column
            label="停机时间"
            prop="stopTime"
            width="80px">
        </el-table-column>
        <el-table-column
            label="故障处置人"
            prop="proPer"
            width="100px">
        </el-table-column>
        <el-table-column
            label="编辑"
            width="100px"
            v-slot:default="scope">
          <el-link  style="margin-right: 10px" @click="faultHistoryEdit(2,scope)"><i class="el-icon-edit"></i></el-link>
          <el-link  style="margin-right: 10px" @click="faultHistoryEdit(3,scope)"><i class="el-icon-download"></i></el-link>
          <el-link  style="margin-right: 10px" @click="faultHistoryEdit(4,scope)"><i class="el-icon-delete"></i></el-link>
        </el-table-column>
      </el-table>
    </el-dialog>
    <!--弹窗显示设备故障履历的列表,编辑内容的弹窗-->
    <el-dialog
        :title="titleUse1"
        :visible.sync="faultHistoryEditDialog"
        width="610px"
        :before-close="handleClose">
      <el-form ref="faultHistoryForm" status-icon :model="faultHistoryForm"  label-width="100px">
        <div style="border: 1px solid red;padding: 10px">
          <div style="margin-bottom:8px;color: red;font-size: 16px;text-align: left">必填项目：</div>
          <el-form-item label="故障信息：">
            <el-input v-model="faultHistoryForm.describe" placeholder="请输入故障描述"
                      style="margin-bottom: 5px"
                      :rows="2"
                      type="textarea"></el-input>
            <el-date-picker
                v-model="faultHistoryForm.date"
                type="date"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" style="width: 140px;margin-right: 10px;margin-bottom: 5px">
            </el-date-picker>
            <el-time-picker
                v-model="faultHistoryForm.time"
                placeholder="请选择时间"
                format="HH:ss:mm"
                value-format="HH:ss:mm"
                style="width: 140px;margin-right: 10px">
            </el-time-picker>
            <el-input v-model="faultHistoryForm.proPer" placeholder="请输入处置人" style="width: 140px"></el-input>
            <div>
              <span style="width: 100px">停机次数：</span>
              <el-input-number v-model="faultHistoryForm.number" label="描述文字" style="width: 135px;margin-right: 30px"></el-input-number>
              <span style="width: 100px">停机时间：</span>
              <el-input-number v-model="faultHistoryForm.stopTime" label="描述文字" style="width: 135px"></el-input-number>
            </div>
          </el-form-item>
        </div>
        <div style="border: 1px solid blue;padding: 10px;margin-top: 10px;margin-bottom: 10px">
          <div style="margin-bottom:8px;color: blue;font-size: 16px;text-align: left">改进后填写：</div>
          <el-form-item label="原因分析：">
            <el-input v-model="faultHistoryForm.reason" placeholder="请输入原因分析"
                      style="margin-bottom: 5px"
                      :rows="2"
                      type="textarea"></el-input>
          </el-form-item>
          <el-form-item label="整改对策：">
            <el-input v-model="faultHistoryForm.method" placeholder="请输入改进措施"
                      style="margin-bottom: 5px"
                      :rows="2"
                      type="textarea"></el-input>
            <el-date-picker
                v-model="faultHistoryForm.metEndTime"
                type="date"
                placeholder="选择完成时间"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" style="width: 210px;margin-right: 20px;margin-bottom: 5px">
            </el-date-picker>
            <el-input v-model="faultHistoryForm.metPer" placeholder="请输入解决人"
                      style="margin-bottom: 5px;width: 210px"></el-input>
          </el-form-item>
          <el-form-item label="横展内容：">
            <el-input v-model="faultHistoryForm.extend" placeholder="请输入横展内容"
                      style="margin-bottom: 5px"
                      :rows="2"
                      type="textarea"></el-input>
            <el-date-picker
                v-model="faultHistoryForm.extDate"
                type="date"
                placeholder="选择完成时间"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" style="width: 210px;margin-right: 20px;margin-bottom: 5px">
            </el-date-picker>
            <el-input v-model="faultHistoryForm.extPer" placeholder="横展负责人"
                      style="margin-bottom: 5px;width: 210px"></el-input>
          </el-form-item>
        </div>
        <div style="border: 1px solid royalblue;padding: 10px;margin-top: 10px;margin-bottom: 10px">
          <div style="margin-bottom:8px;color: royalblue;font-size: 16px;text-align: left">关联设备维修：</div>
        </div>
        <el-form-item label="提交结果：">
          <el-button type="primary" @click="faultHistoryEditClick">确定</el-button>
          <el-button @click="faultHistoryEditDialog=false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!--弹窗显示设备维修履历的列表-->
    <el-dialog
        :title="titleUse"
        :visible.sync="maintenanceDialog"
        width="850px"
        :before-close="handleClose">
      <div style="text-align: right">
        <el-link v-if="maintenanceList.length===0" style="margin-bottom: 10px;color: red" @click="maintenanceEdit(1,null)">新建</el-link>
      </div>
      <el-table
          :data="maintenanceList"
          style="width: 100%"
          stripe
          border>
        <el-table-column
            label="维修部位"
            prop="position"
            width="160px">
        </el-table-column>
        <el-table-column
            label="维修内容"
            prop="content"
            width="280px">
        </el-table-column>
        <el-table-column
            label="维修形式"
            prop="repairType"
            width="80px">
        </el-table-column>
        <el-table-column
            label="完成时间"
            prop="endDate"
            width="100px">
        </el-table-column>
        <el-table-column
            label="维修人"
            prop="repPer"
            width="100px">
        </el-table-column>
        <el-table-column
            label="编辑"
            width="100px"
            v-slot:default="scope">
          <el-link  style="margin-right: 10px" @click="maintenanceEdit(2,scope)"><i class="el-icon-edit"></i></el-link>
          <el-link  style="margin-right: 10px" @click="maintenanceEdit(3,scope)"><i class="el-icon-download"></i></el-link>
          <el-link  style="margin-right: 10px" @click="maintenanceEdit(4,scope)"><i class="el-icon-delete"></i></el-link>
        </el-table-column>
      </el-table>
    </el-dialog>
    <!--弹窗显示设备维修履历的列表,编辑内容的弹窗-->
    <el-dialog
        :title="titleUse1"
        :visible.sync="maintenanceEditDialog"
        width="610px"
        :before-close="handleClose">
      <el-form ref="maintenanceForm" status-icon :model="maintenanceForm"  label-width="100px">
        <div style="border: 1px solid red;padding: 10px">
          <div style="margin-bottom:8px;color: red;font-size: 16px;text-align: left">必填项目：</div>
          <el-form-item label="维修部位：">
            <el-input v-model="maintenanceForm.position" placeholder="请输入维修部位"></el-input>
          </el-form-item>
          <el-form-item label="维修内容：">
            <el-input v-model="maintenanceForm.content" placeholder="请输入维修内容"
                      style="margin-bottom: 5px"
                      :rows="2"
                      type="textarea"></el-input>
          </el-form-item>
          <el-form-item label="完成信息：">
            <el-date-picker
                v-model="maintenanceForm.endDate"
                type="date"
                placeholder="选择完成日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" style="width: 140px;margin-right: 10px;margin-bottom: 5px">
            </el-date-picker>
            <el-input v-model="maintenanceForm.repPer" placeholder="请输入解决人"
                      style="margin-right: 10px;width: 140px"></el-input>
            <el-select v-model="maintenanceForm.repairType" clearable placeholder="请选择维修类型" style="width: 140px;">
              <el-option
                  v-for="item in repairTypeOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="提交结果：">
            <el-button type="primary" @click="maintenanceEditClick">确定</el-button>
            <el-button @click="maintenanceEditDialog=false">取消</el-button>
          </el-form-item>
        </div>
      </el-form>
    </el-dialog>
    <!--抽屉放置区域-->
  </div>
</template>

<script>
import {tree_workshop_english, tree_workshop_op_chinese, tree_workshop_op_russian} from "@/configUse";
import _ from "lodash";

export default {
  name: "assemblyEquipment",
  components: {},
  data() {
    return {
      activeName:'first',
      //用户权限相关的变量
      useName:'',//用户名称
      useId:'',//用户编号
      usePower:'',//用户权限
      //记录语言的变量
      languageS:'chinese',

      //页面变量
      pageVal:{
        //表头中的板块名称
        sector:'装配设备管理',
        tabs1:'设备台账',
        tabs2:'加油点管理',
      },

      //树形导航用到的变量
      treeList:tree_workshop_op_chinese,
      //导航筛选的变量
      filterText:'',
      //树形的导航用到的数据模板
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      //点击的树形结构内容Data
      treeData:null,
      //点击的树形结构内容
      treeNode:null,

      //设备台账总表
      equipmentList:[
        {
          //id
          id:0,
          //工序号
          op:'',
          //所属车间
          workshop:'',
          //设备名称
          equipmentName:'',
          //设备型号
          equipmentType:'',
          //设备类别
          equipmentItem:'',
          //设备编号
          equipmentId:'',
          //图纸编号
          drawingNo:'',
          //应用机型
          modelId:'',
          //设备故障履历
          faultHistory:'',
          //设备维修履历
          maintenance:'',
          //加油点
          oil:'',
          //紧固点
          fasten:'',
          //校准点
          calibration:'',
          //电器件
          electrical:'',
          //其他点检
          others:'',
          //删除标记位
          deleteSign:1,
          //创建时间
          establishTime:'',
          //修改时间
          updateTime:'',
          //编辑人姓名
          editName:'',
        }
      ],
      //编辑设备台账总表的表单
      equipmentListForm: {
      //id
      id:0,
          //工序号
          op:'',
        //所属车间
        workshop:'',
        //设备名称
        equipmentName:'',
        //设备型号
        equipmentType:'',
        //设备类别
        equipmentItem:'',
        //设备编号
        equipmentId:'',
        //图纸编号
        drawingNo:'',
        //应用机型
        modelId:'',
        //设备故障履历
        faultHistory:'',
        //设备维修履历
        maintenance:'',
        //加油点
        oil:'',
        //紧固点
        fasten:'',
        //校准点
        calibration:'',
        //电器件
        electrical:'',
        //其他点检
        others:'',
        //删除标记位
        deleteSign:1,
        //创建时间
        establishTime:'',
        //修改时间
        updateTime:'',
        //编辑人姓名
        editName:'',
    },
      //编辑总表，点击后记录的Scope格式
      equipmentListScope:null,
      //编辑总表，记录是那种编辑：1.编辑，2新增，3删除
      equipmentListDoe:0,

      //设备故障用的列表
      faultHistoryList:[
        {
          // 故障描述
          describe:'',
          // 故障日期
          date:'',
          // 故障时间
          time:'',
          // 故障次数
          number:'',
          // 故障处置人
          proPer:'',
          //停机时间
          stopTime:'',
          // 原因分析
          reason:'',
          // 整改对策
          method:'',
          // 故障解决人
          metPer:'',
          // 整改完成时间
          metEndTime:'',
          // 横展
          extend:'',
          // 横展完成时间
          extDate:'',
          // 横展负责人
          extPer:'',
          //最后编辑时间
          editTime:'',
          //预留1
          reserve1:'预留',
          //预留2
          reserve2:'预留',
          //预留3
          reserve3:'预留',
        }
      ],
      //设备故障记录用到的修改表
      faultHistoryForm:{
        // 故障描述
        describe:'',
        // 故障日期
        date:'',
        // 故障时间
        time:'',
        // 故障次数
        number:'',
        // 故障处置人
        proPer:'',
        //停机时间
        stopTime:'',
        // 原因分析
        reason:'',
        // 整改对策
        method:'',
        // 故障解决人
        metPer:'',
        // 整改完成时间
        metEndTime:'',
        // 横展
        extend:'',
        // 横展完成时间
        extDate:'',
        // 横展负责人
        extPer:'',
        //最后编辑时间
        editTime:'',
        //预留1
        reserve1:'预留',
        //预留2
        reserve2:'预留',
        //预留3
        reserve3:'预留',
      },
      //编辑设备故障履历，记录的事那种编辑：1.新增；2.编辑；3.删除；
      faultHistoryDoe:0,
      //编辑设备故障履历，点击后记录的Scope
      faultHistoryScope:null,

      //设备维修履历用的列表
      maintenanceList:[
        {
          //主键
          id:0,
          //维修部位
          position:'',
          //维修内容
          content:'',
          // 维修形式
          repairType:'',
          //完成时间
          endDate:'',
          //维修人
          repPer:'',
          //最后编辑时间
          editTime: '',
          //预留1
          reserve1:'预留',
          //预留2
          reserve2:'预留',
          //预留3
          reserve3:'预留',

    }
      ],
      //设备维修履历用的修改表
      maintenanceForm:{
        //主键
        id:0,
        //维修部位
        position:'',
        //维修内容
        content:'',
        // 维修形式
        repairType:'',
        //完成时间
        endDate:'',
        //维修人
        repPer:'',
        //最后编辑时间
        editTime: '',
        //预留1
        reserve1:'预留',
        //预留2
        reserve2:'预留',
        //预留3
        reserve3:'预留',

      },
      //编辑设备维修履历，记录的事那种编辑：1.新增；2.编辑；3.删除；
      maintenanceDoe:0,
      //编辑设备维修履历，点击后记录的Scope
      maintenanceScope:null,


      //弹窗用到的变量
      //故障履历、更换履历等一级表头用到变量
      titleUse:'提示',
      //二级弹框用到的变量
      titleUse1:'提示',
      // 编辑大表用到的弹窗
      equipmentListDialog:false,
      //设备故障履历用的列表编辑弹窗
      faultHistoryDialog:false,
      //设备故障履历用的列表编辑弹窗,点击编辑的弹窗
      faultHistoryEditDialog:false,
      //设备维修履历用的列表编辑弹窗
      maintenanceDialog:false,
      //设备维修履历用的列表编辑弹窗,点击编辑的弹窗
      maintenanceEditDialog:false,
      //记录设备类别
      equipmentItemOptions:[
        {value:'拧紧轴/Electric torque wrench/Электрогайковерт',label: '拧紧轴/Electric torque wrench/Электрогайковерт'},
      ],
      //记录应用机型
      modelIdOptions:[
        {value:'EB/EN',label:'EB/EN'},
        {value:'EB全系',label:'EB全系'},
        {value:'EN全系',label:'EN全系'},
        {value:'EB05',label:'EB05'},
        {value:'EB35',label:'EB35'},
        {value:'EB75',label:'EB75'},
        {value:'EN19',label:'EN19'},
        {value:'EN38',label:'EN38'},
      ],
      //记录维修类型
      repairTypeOptions:[
        {value:'主动维修',label: '主动维修'},
        {value:'故障维修',label: '故障维修'},
        {value:'设备改进',label: '设备改进'},
      ],
    }
  },
  watch: {},
  methods: {
    //语言选择的函数变化
    chooseLanguage(doe){
      this.languageS=doe
      //变更树形导航结构
      if (doe==='chinese'){
        this.treeList=tree_workshop_op_chinese
      }
      else if (doe==='english'){
        this.treeList=tree_workshop_english
      }
      else if (doe==='russian'){
        this.treeList=tree_workshop_op_russian
      }
    },
    //退出登录
    logOut(){
      localStorage.removeItem('u_token');
      localStorage.removeItem('userName')
      this.$router.push('UserLogin')
    },
    //查询用户信息的函数
    inquiry(){
      //输入用户编号，向后端查询信息
      const useId=localStorage.getItem('userName').replace(/"/g, '');
      this.$request.post('/useQueryPower',{
        queryFiledName:'changeModel',
        userId:useId,
      }).then(result=>{
        if (result.code === 401) {
          this.$router.push('UserLogin')
          alert("您未登录，请登录")
        }else {
          this.useName=result.data.name
          this.usePower=result.data.changeModel
          this.useId=useId
          console.log(this.useId,this.usePower,this.useName)
        }
      })
    },
    //在tab控件上单击的函数
    handleClick(tab, event) {
      console.log(tab, event);
    },
    // 通用，弹窗关闭的时候
    handleClose(done) {
      this.$confirm('确认关闭？')
          // eslint-disable-next-line no-unused-vars
          .then(_ => {
            done();
          })
          // eslint-disable-next-line no-unused-vars
          .catch(_ => {});
    },
    //单击导航结构的函数
    treeClick(data,node) {
      if (node.level>=2){
        this.treeData=data
        this.treeNode=node
        let firstFiledVal=''
        if (this.treeNode.parent.label==='装配车间' ||
            this.treeNode.parent.label==='Assembly workshop' ||
            this.treeNode.parent.label==='Сборочная линия'){
          firstFiledVal='装配车间'
        }
        //向后端查询数据
        this.$request.post('/assemblyEquipmentInquiryTree',{
          firstFiledName:'workshop',
          firstFiledVal:firstFiledVal,
          secondFiledName:'op',
          secondFiledVal:this.treeNode.data.label
        }).then(result=>{
          if (result.code === 401) {
            this.$router.push('UserLogin')
            alert("您未登录，请登录")
          }else {
            this.equipmentList=result.data
          }
        })
      }
    },
    // 导航筛选
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    //编辑大表，准备弹窗
    equipmentListEdit(doe,scope){
      if (this.treeNode===null || this.treeData===null || this.treeNode.level<2){
        alert("请先选择工序号")
        return
      }
      this.equipmentListScope=scope
      this.equipmentListDoe=doe
      // 是插入操作
      if (doe===2){
        this.titleUse='您正在插入一条设备信息'
        //初始化数据
        this.equipmentListForm={
          //id
          id:-1,
          //工序号
          op:'',
          //所属车间
          workshop:'',
          //设备名称
          equipmentName:'',
          //设备型号
          equipmentType:'',
          //设备类别
          equipmentItem:'',
          //设备编号
          equipmentId:'',
          //图纸编号
          drawingNo:'',
          //应用机型
          modelId:'',
          //加油点
          oil:'',
          //紧固点
          fasten:'',
          //校准点
          calibration:'',
          //电器件
          electrical:'',
          //其他点检
          others:'',
          //删除标记位
          deleteSign:1,
          //创建时间
          establishTime:'',
          //修改时间
          updateTime:'',
          //编辑人姓名
          editName:this.useName,
        }
        //初识化车间、工序
        if (this.treeNode.parent.label==='装配车间' ||
            this.treeNode.parent.label==='Assembly workshop' ||
            this.treeNode.parent.label==='Сборочная линия'){
          this.equipmentListForm.workshop='装配车间'
        }
        this.equipmentListForm.op=this.treeNode.label
        //打开弹窗
        this.equipmentListDialog=true
      }
      //是编辑操作
      else if (doe===1){
        this.titleUse='您正在修改一条设备信息'
        this.equipmentListForm=_.cloneDeep(scope.row)
        //组合编辑人
        this.equipmentListForm.editName=this.useName
        this.equipmentListDialog=true
      }
      //是删除操作
      else if (doe===3){
        this.titleUse='您正在删除一条设备信息'
        this.equipmentListForm=_.cloneDeep(scope.row)
        //组合编辑人
        this.equipmentListDialog=true
      }
    },

    //编辑大表中的弹窗中点击确定按钮(实现了编辑的功能）
    equipmentListRowClick(){
      //数据校核
      if (this.equipmentListForm.equipmentName===''){
        alert("请写入设备名称")
      }
      else if (this.equipmentListForm.equipmentType===''){
        alert("请写入设备型号")
      }
      else if (this.equipmentListForm.equipmentId===''){
        alert("请写入设备编号")
      }
      else if (this.equipmentListForm.equipmentItem===''){
        alert("请选择设备类型")
      }
      else if (this.equipmentListForm.modelId===''){
        alert("请选择应用机型")
      }
      else {
        //是向下插入
        if (this.equipmentListDoe===2){
          // 向后端发送信息
          this.$request.post('assemblyEquipmentInsert',this.equipmentListForm).then(result=>{
            if (result.code === 401) {
              this.$router.push('UserLogin')
              alert("您未登录，请登录")
            }else {
              //组合大表数据,用的是重新查询
              //向后端查询数据
              this.$request.post('/assemblyEquipmentInquiryTree',{
                firstFiledName:'workshop',
                firstFiledVal:this.treeNode.parent.label,
                secondFiledName:'op',
                secondFiledVal:this.treeNode.data.label
              }).then(result=>{
                if (result.code === 401) {
                  this.$router.push('UserLogin')
                  alert("您未登录，请登录")
                }else {
                  this.equipmentList=result.data
                }
              })
              this.equipmentListDialog=false
              alert("插入成功")
            }
          })
        }
        //是编辑
        else if (this.equipmentListDoe===1){
          // 向后端发送信息
          this.$request.post('assemblyEquipmentEdit',this.equipmentListForm).then(result=>{
            if (result.code === 401) {
              this.$router.push('UserLogin')
              alert("您未登录，请登录")
            }else {
              //重新组合大表数据
              this.equipmentList.splice(this.equipmentListScope.$index,1,this.equipmentListForm)
              this.equipmentListDialog=false
              alert("修改成功")
            }
          })
        }
        //是删除
        else if (this.equipmentListDoe===3){
          //组合信息
          this.equipmentList[this.equipmentListScope.$index].deleteSign=0
          this.equipmentList[this.equipmentListScope.$index].editName=this.useName
          // 向后端发送信息
          this.$request.post('assemblyEquipmentEdit',this.equipmentList[this.equipmentListScope.$index]).then(result=>{
            if (result.code === 401) {
              this.$router.push('UserLogin')
              alert("您未登录，请登录")
            }else {
              //重新组合大表数据
              this.equipmentList.splice(this.equipmentListScope.$index,1)
              this.equipmentListDialog=false
              alert("修改成功")
            }
          })
        }
      }
    },
    //点击查看设备履历
    faultHistoryShow(scope){
      this.equipmentListScope=scope
      this.titleUse='设备故障履历列表'

      //给设备故障履历进行赋值
      this.faultHistoryList=[]
      let tempList= this.equipmentList[this.equipmentListScope.$index].faultHistory.split('|-|')
      for (let i = 0; i < tempList.length-1; i++) {
        let tempItem=tempList[i].split('|%|')
        let temp={
          // 故障描述
          describe:tempItem[0],
          // 故障日期
          date:tempItem[1],
          // 故障时间
          time:tempItem[2],
          // 故障次数
          number:tempItem[3],
          // 故障处置人
          proPer:tempItem[4],
          //停机时间
          stopTime:tempItem[5],
          // 原因分析
          reason:tempItem[6],
          // 整改对策
          method:tempItem[7],
          // 故障解决人
          metPer:tempItem[8],
          // 整改完成时间
          metEndTime:tempItem[9],
          // 横展
          extend:tempItem[10],
          // 横展完成时间
          extDate:tempItem[11],
          // 横展负责人
          extPer:tempItem[12],
          //最后编辑时间
          editTime: tempItem[13],
          //预留1
          reserve1:tempItem[14],
          //预留2
          reserve2:tempItem[15],
          //预留3
          reserve3:tempItem[16],
        }
        this.faultHistoryList.push(temp)
      }

      this.faultHistoryDialog=true
    },
    //点击编辑设备履历的选项，进行弹窗：1:新建；2：编辑；3：向下插入：4：删除；
    faultHistoryEdit(doe,scope){
      // 把参数传递出去
      this.faultHistoryDoe=doe
      this.faultHistoryScope=scope
      //是新建操作
      if (doe===1){
        //数据初始化
        this.faultHistoryForm={
          // 故障描述
          describe:'',
              // 故障日期
              date:'',
              // 故障时间
              time:'',
              // 故障次数
              number:'',
              // 故障处置人
              proPer:'',
              //停机时间
              stopTime:'',
              // 原因分析
              reason:'',
              // 整改对策
              method:'',
              // 故障解决人
              metPer:'',
              // 整改完成时间
              metEndTime:'',
              // 横展
              extend:'',
              // 横展完成时间
              extDate:'',
              // 横展负责人
              extPer:'',
              //预留1
              reserve1:'预留',
              //预留2
              reserve2:'预留',
              //预留3
              reserve3:'预留',
        }
        this.titleUse1='您正在新建一条设备故障履历'
        this.faultHistoryEditDialog=true
      }
      //是编辑
      else if (doe===2){
        //数据初始化
        this.faultHistoryForm=_.cloneDeep(this.faultHistoryScope.row)
        this.titleUse1='您正在修改本条设备故障履历'
        this.faultHistoryEditDialog=true
      }
      //是向下插入
      else if (doe===3){
        //数据初始化
        this.faultHistoryForm={
          // 故障描述
          describe:'',
          // 故障日期
          date:'',
          // 故障时间
          time:'',
          // 故障次数
          number:'',
          // 故障处置人
          proPer:'',
          //停机时间
          stopTime:'',
          // 原因分析
          reason:'',
          // 整改对策
          method:'',
          // 故障解决人
          metPer:'',
          // 整改完成时间
          metEndTime:'',
          // 横展
          extend:'',
          // 横展完成时间
          extDate:'',
          // 横展负责人
          extPer:'',
          //预留1
          reserve1:'预留',
          //预留2
          reserve2:'预留',
          //预留3
          reserve3:'预留',
        }
        this.titleUse1='您正在向下插入一条设备故障履历'
        this.faultHistoryEditDialog=true
      }
      //是删除操作
      else if (doe===4){
        {
          //数据初始化
          this.faultHistoryForm=_.cloneDeep(this.faultHistoryScope.row)
          this.titleUse1='您正在删除本条设备故障履历'
          this.faultHistoryEditDialog=true
        }
      }
    },
    //编辑设备故障履历弹窗中的确定按钮
    faultHistoryEditClick(){
      //数据校验
      if (this.faultHistoryDoe===1 || this.faultHistoryDoe===2){
        if (this.faultHistoryForm.describe===''){
          alert('请输入问题描述')
          return
        }
        else if (this.faultHistoryForm.date===''){
          alert('请选择发生日期')
          return
        }
        else if (this.faultHistoryForm.time===''){
          alert('请选择发生时间')
          return
        }
        else if (this.faultHistoryForm.proPer===''){
          alert('请输入处置人')
          return;
        }
        else if (this.faultHistoryForm.number===0){
          alert('请输入停机次数')
          return;
        }
        else if (this.faultHistoryForm.stopTime===0){
          alert('请输入停机时间')
          return;
        }
      }

      //数据赋值，赋值到一个直接存入大表中的字符串
      let str=''
      //是新建操作，直接进入数据组合
      if (this.faultHistoryDoe===1){
        //给最后编辑时间赋值
        const now = new Date();
        const year = now.getFullYear();
        const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
        const day = String(now.getDate()).padStart(2, '0');
        const hours = String(now.getHours()).padStart(2, '0');
        const minutes = String(now.getMinutes()).padStart(2, '0');
        const seconds = String(now.getSeconds()).padStart(2, '0');
        this.faultHistoryForm.editTime=`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
        str=this.faultHistoryForm.describe+'|%|'+
            this.faultHistoryForm.date+'|%|'+
            this.faultHistoryForm.time+'|%|'+
            this.faultHistoryForm.number+'|%|'+
            this.faultHistoryForm.proPer+'|%|'+
            this.faultHistoryForm.stopTime+'|%|'+
            this.faultHistoryForm.reason+'|%|'+
            this.faultHistoryForm.method+'|%|'+
            this.faultHistoryForm.metPer+'|%|'+
            this.faultHistoryForm.metEndTime+'|%|'+
            this.faultHistoryForm.extend+'|%|'+
            this.faultHistoryForm.extDate+'|%|'+
            this.faultHistoryForm.extPer+'|%|'+
            this.faultHistoryForm.editTime+'|%|'+
            this.faultHistoryForm.reserve1+'|%|'+
            this.faultHistoryForm.reserve2+'|%|'+
            this.faultHistoryForm.reserve3+'|-|'
      }
      //是编辑一条数据，直接对大表中的数据进行操作
      else if (this.faultHistoryDoe===2){
        //给最后编辑时间赋值
        const now = new Date();
        const year = now.getFullYear();
        const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
        const day = String(now.getDate()).padStart(2, '0');
        const hours = String(now.getHours()).padStart(2, '0');
        const minutes = String(now.getMinutes()).padStart(2, '0');
        const seconds = String(now.getSeconds()).padStart(2, '0');
        this.faultHistoryForm.editTime=`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
        let strItemTemp =this.faultHistoryForm.describe+'|%|'+
            this.faultHistoryForm.date+'|%|'+
            this.faultHistoryForm.time+'|%|'+
            this.faultHistoryForm.number+'|%|'+
            this.faultHistoryForm.proPer+'|%|'+
            this.faultHistoryForm.stopTime+'|%|'+
            this.faultHistoryForm.reason+'|%|'+
            this.faultHistoryForm.method+'|%|'+
            this.faultHistoryForm.metPer+'|%|'+
            this.faultHistoryForm.metEndTime+'|%|'+
            this.faultHistoryForm.extend+'|%|'+
            this.faultHistoryForm.extDate+'|%|'+
            this.faultHistoryForm.extPer+'|%|'+
            this.faultHistoryForm.editTime+'|%|'+
            this.faultHistoryForm.reserve1+'|%|'+
            this.faultHistoryForm.reserve2+'|%|'+
            this.faultHistoryForm.reserve3
        let tempList=this.equipmentListScope.row.faultHistory.split('|-|')
        //替换数据
        tempList[this.faultHistoryScope.$index]=strItemTemp
        str=''
        //组合str
        for (let i = 0; i < tempList.length-1; i++) {
          str=str+tempList[i]+'|-|'
        }
      }
      //是向下插入一条数据，直接对大表中的数据进行操作
      else if (this.faultHistoryDoe===3){
        //给最后编辑时间赋值
        const now = new Date();
        const year = now.getFullYear();
        const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
        const day = String(now.getDate()).padStart(2, '0');
        const hours = String(now.getHours()).padStart(2, '0');
        const minutes = String(now.getMinutes()).padStart(2, '0');
        const seconds = String(now.getSeconds()).padStart(2, '0');
        this.faultHistoryForm.editTime=`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
        let strItemTemp =this.faultHistoryForm.describe+'|%|'+
            this.faultHistoryForm.date+'|%|'+
            this.faultHistoryForm.time+'|%|'+
            this.faultHistoryForm.number+'|%|'+
            this.faultHistoryForm.proPer+'|%|'+
            this.faultHistoryForm.stopTime+'|%|'+
            this.faultHistoryForm.reason+'|%|'+
            this.faultHistoryForm.method+'|%|'+
            this.faultHistoryForm.metPer+'|%|'+
            this.faultHistoryForm.metEndTime+'|%|'+
            this.faultHistoryForm.extend+'|%|'+
            this.faultHistoryForm.extDate+'|%|'+
            this.faultHistoryForm.extPer+'|%|'+
            this.faultHistoryForm.editTime+'|%|'+
            this.faultHistoryForm.reserve1+'|%|'+
            this.faultHistoryForm.reserve2+'|%|'+
            this.faultHistoryForm.reserve3
        let tempList=this.equipmentListScope.row.faultHistory.split('|-|')
        //插入数据
        tempList.splice(this.faultHistoryScope.$index+1,0,strItemTemp)
        //组合str
        str=''
        for (let i = 0; i < tempList.length-1; i++) {
          str=str+tempList[i]+'|-|'
        }
      }
      //是删除本条数据，直接对大表中的数据进行操作
      else if (this.faultHistoryDoe===4){
        //组合数据
        let tempList=this.equipmentListScope.row.faultHistory.split('|-|')
        //删除数据
        tempList.splice(this.faultHistoryScope.$index,1,)
        //组合str
        str=''
        for (let i = 0; i < tempList.length-1; i++) {
          str=str+tempList[i]+'|-|'
        }
      }

      //向后端写入数据
      if (str===''){
        alert('数据组合出错，请联系管理员')
      }
      else {
        this.$request.post('/assemblyEquipmentEditOneById',{
          id:this.equipmentListScope.row.id,
          filedName:'faultHistory',
          filedVal:str
        }).then(result=>{
          if (result.code === 401) {
            this.$router.push('UserLogin')
            alert("您未登录，请登录")
          }else {
            //给大表赋值
            this.equipmentList[this.equipmentListScope.$index].faultHistory=result.data
            //给设备故障履历进行赋值
            this.faultHistoryList=[]
            let tempList= this.equipmentList[this.equipmentListScope.$index].faultHistory.split('|-|')
            for (let i = 0; i < tempList.length-1; i++) {
              let tempItem=tempList[i].split('|%|')
              let temp={
                // 故障描述
                describe:tempItem[0],
                // 故障日期
                date:tempItem[1],
                // 故障时间
                time:tempItem[2],
                // 故障次数
                number:tempItem[3],
                // 故障处置人
                proPer:tempItem[4],
                //停机时间
                stopTime:tempItem[5],
                // 原因分析
                reason:tempItem[6],
                // 整改对策
                method:tempItem[7],
                // 故障解决人
                metPer:tempItem[8],
                // 整改完成时间
                metEndTime:tempItem[9],
                // 横展
                extend:tempItem[10],
                // 横展完成时间
                extDate:tempItem[11],
                // 横展负责人
                extPer:tempItem[12],
                //最后编辑时间
                editTime: tempItem[13],
                //预留1
                reserve1:tempItem[14],
                //预留2
                reserve2:tempItem[15],
                //预留3
                reserve3:tempItem[16],
              }
              this.faultHistoryList.push(temp)
            }
            this.faultHistoryEditDialog=false
          }
        })
      }

    },
    //点击查看设备维修履历
    maintenanceShow(scope){
      this.equipmentListScope=scope
      this.titleUse='设备维修/改进履历列表'

      //给设备故障履历进行赋值
      this.maintenanceList=[]
      let tempList= this.equipmentList[this.equipmentListScope.$index].maintenance.split('|-|')
      for (let i = 0; i < tempList.length-1; i++) {
        let tempItem = tempList[i].split('|%|')
        let temp = {
          // 故障描述
          position: tempItem[0],
          // 故障日期
          content: tempItem[1],
          // 故障时间
          repairType: tempItem[2],
          // 故障次数
          endDate: tempItem[3],
          // 故障处置人
          repPer: tempItem[4],
          //停机时间
          editTime: tempItem[5],
          //预留1
          reserve1: tempItem[6],
          //预留2
          reserve2: tempItem[7],
          //预留3
          reserve3: tempItem[8],
        }
        this.maintenanceList.push(temp)
      }

      this.maintenanceDialog=true
    },
    //点击编辑设备履历的选项，进行弹窗：1:新建；2：编辑；3：向下插入：4：删除；
    maintenanceEdit(doe,scope){
      // 把参数传递出去
      this.maintenanceDoe=doe
      this.maintenanceScope=scope
      //是新建操作
      if (doe===1){
        //数据初始化
        this.maintenanceForm={
          //主键
          id:0,
          //维修部位
          position:'',
          //维修内容
          content:'',
          // 维修形式
          repairType:'',
          //完成时间
          endDate:'',
          //维修人
          repPer:'',
          //最后编辑时间
          editTime: '',
          //预留1
          reserve1:'预留',
          //预留2
          reserve2:'预留',
          //预留3
          reserve3:'预留',
        }
        this.titleUse1='您正在新建一条设备维修/改进履历'
        this.maintenanceEditDialog=true
      }
      //是编辑操作
      else if (doe===2){
        //数据初始化
        this.maintenanceForm=_.cloneDeep(this.maintenanceScope.row)
        this.titleUse1='您正在修改本条设备维修/改进履历'
        this.maintenanceEditDialog=true
      }
      //是向下插入操作
      else if (doe===3){
        //数据初始化
        this.maintenanceForm={
          //主键
          id:0,
          //维修部位
          position:'',
          //维修内容
          content:'',
          // 维修形式
          repairType:'',
          //完成时间
          endDate:'',
          //维修人
          repPer:'',
          //最后编辑时间
          editTime: '',
          //预留1
          reserve1:'预留',
          //预留2
          reserve2:'预留',
          //预留3
          reserve3:'预留',
        }
        this.titleUse1='您正在插入一条设备维修/改进履历'
        this.maintenanceEditDialog=true
      }
      //是删除操作
      else if (doe===4){
        //数据初始化
        this.maintenanceForm=_.cloneDeep(this.maintenanceScope.row)
        this.titleUse1='您正在删除本条设备维修/改进履历'
        this.maintenanceEditDialog=true
      }
    },
    //编辑设备维修履历弹窗中的确定按钮
    maintenanceEditClick(){
      //数据校验
      if (this.maintenanceDoe===1 || this.maintenanceDoe===2){
        if (this.maintenanceForm.position===''){
          alert('请输入维修/改进部位')
          return
        }
        else if (this.maintenanceForm.content===''){
          alert('请输入维修内容')
          return
        }
        else if (this.maintenanceForm.repairType===''){
          alert('请选择维修/改进形式')
          return
        }
        else if (this.maintenanceForm.endDate===''){
          alert('请选择完成时间')
          return;
        }
        else if (this.maintenanceForm.repPer===''){
          alert('请输入改进人')
          return;
        }
      }

      //数据赋值，赋值到一个直接存入大表中的字符串
      let str=''
      //是新建操作，直接进入数据组合
      if (this.maintenanceDoe===1){
        //给最后编辑时间赋值
        const now = new Date();
        const year = now.getFullYear();
        const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
        const day = String(now.getDate()).padStart(2, '0');
        const hours = String(now.getHours()).padStart(2, '0');
        const minutes = String(now.getMinutes()).padStart(2, '0');
        const seconds = String(now.getSeconds()).padStart(2, '0');
        this.maintenanceForm.editTime=`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
        str=this.maintenanceForm.position+'|%|'+
            this.maintenanceForm.content+'|%|'+
            this.maintenanceForm.repairType+'|%|'+
            this.maintenanceForm.endDate+'|%|'+
            this.maintenanceForm.repPer+'|%|'+
            this.maintenanceForm.editTime+'|%|'+
            this.maintenanceForm.reserve1+'|%|'+
            this.maintenanceForm.reserve2+'|%|'+
            this.maintenanceForm.reserve3+'|-|'
      }
      //是编辑操作
      else if (this.maintenanceDoe===2){
        //给最后编辑时间赋值
        const now = new Date();
        const year = now.getFullYear();
        const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
        const day = String(now.getDate()).padStart(2, '0');
        const hours = String(now.getHours()).padStart(2, '0');
        const minutes = String(now.getMinutes()).padStart(2, '0');
        const seconds = String(now.getSeconds()).padStart(2, '0');
        this.maintenanceForm.editTime=`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
        let strItemTemp=this.maintenanceForm.position+'|%|'+
            this.maintenanceForm.content+'|%|'+
            this.maintenanceForm.repairType+'|%|'+
            this.maintenanceForm.endDate+'|%|'+
            this.maintenanceForm.repPer+'|%|'+
            this.maintenanceForm.editTime+'|%|'+
            this.maintenanceForm.reserve1+'|%|'+
            this.maintenanceForm.reserve2+'|%|'+
            this.maintenanceForm.reserve3

        //重新对数据进行整理
        let tempList=this.equipmentListScope.row.maintenance.split('|-|')
        //替换数据
        tempList[this.maintenanceScope.$index]=strItemTemp
        str=''
        //组合str
        for (let i = 0; i < tempList.length-1; i++) {
          str=str+tempList[i]+'|-|'
        }
      }
      //是向下插入
      else if (this.maintenanceDoe===3){
        //给最后编辑时间赋值
        const now = new Date();
        const year = now.getFullYear();
        const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
        const day = String(now.getDate()).padStart(2, '0');
        const hours = String(now.getHours()).padStart(2, '0');
        const minutes = String(now.getMinutes()).padStart(2, '0');
        const seconds = String(now.getSeconds()).padStart(2, '0');
        this.maintenanceForm.editTime=`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
        let strItemTemp=this.maintenanceForm.position+'|%|'+
            this.maintenanceForm.content+'|%|'+
            this.maintenanceForm.repairType+'|%|'+
            this.maintenanceForm.endDate+'|%|'+
            this.maintenanceForm.repPer+'|%|'+
            this.maintenanceForm.editTime+'|%|'+
            this.maintenanceForm.reserve1+'|%|'+
            this.maintenanceForm.reserve2+'|%|'+
            this.maintenanceForm.reserve3

        //重新对数据进行整理
        let tempList=this.equipmentListScope.row.maintenance.split('|-|')
        //替换数据
        tempList.splice(this.equipmentListScope.$index+1,0,strItemTemp)
        str=''
        //组合str
        for (let i = 0; i < tempList.length-1; i++) {
          str=str+tempList[i]+'|-|'
        }
      }
      //是删除本条
      else if (this.maintenanceDoe===4){
        //给最后编辑时间赋值
        const now = new Date();
        const year = now.getFullYear();
        const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
        const day = String(now.getDate()).padStart(2, '0');
        const hours = String(now.getHours()).padStart(2, '0');
        const minutes = String(now.getMinutes()).padStart(2, '0');
        const seconds = String(now.getSeconds()).padStart(2, '0');
        this.maintenanceForm.editTime=`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`

        //重新对数据进行整理
        let tempList=this.equipmentListScope.row.maintenance.split('|-|')
        //替换数据
        tempList.splice(this.equipmentListScope.$index,1)
        str=''
        //组合str
        for (let i = 0; i < tempList.length-1; i++) {
          str=str+tempList[i]+'|-|'
        }
      }

      //向后端写入数据
      if (str===''){
        alert('数据组合出错，请联系管理员')
      }
      else {
        this.$request.post('/assemblyEquipmentEditOneById',{
          id:this.equipmentListScope.row.id,
          filedName:'maintenance',
          filedVal:str
        }).then(result=>{
          if (result.code === 401) {
            this.$router.push('UserLogin')
            alert("您未登录，请登录")
          }else {
            //给大表赋值
            this.equipmentList[this.equipmentListScope.$index].maintenance=result.data
            //给设备故障履历进行赋值
            this.maintenanceList=[]
            let tempList= this.equipmentList[this.equipmentListScope.$index].maintenance.split('|-|')
            for (let i = 0; i < tempList.length-1; i++) {
              let tempItem=tempList[i].split('|%|')
              let temp={
                // 故障描述
                position:tempItem[0],
                // 故障日期
                content:tempItem[1],
                // 故障时间
                repairType:tempItem[2],
                // 故障次数
                endDate:tempItem[3],
                // 故障处置人
                repPer:tempItem[4],
                //停机时间
                editTime:tempItem[5],
                //预留1
                reserve1:tempItem[6],
                //预留2
                reserve2:tempItem[7],
                //预留3
                reserve3:tempItem[8],
              }
              this.maintenanceList.push(temp)
            }
            this.maintenanceEditDialog=false
          }
        })
      }
    },

  },
  mounted() {
    this.inquiry()
    //清理数据
    //大表数据
    this.equipmentList=[]
    //设备故障履历
    this.faultHistoryList=[]
    //设备维修履历
    this.maintenanceList=[]
  }
}
</script>


<style scoped>
/* 主体左侧的工作步骤栏用到的数据包围的div的样式*/

.el-footer {
  background-color: #ffffff;
  color: #333;
  text-align: center;
  border-width: 3px; /* 设置边框宽度为3像素 */
  border-color: blue; /* 设置边框颜色为蓝色 */
  border-style: solid; /* 设置边框样式为实线 */
  padding: 10px; /* 添加内边距 */
  border-left-color: white;
  border-top: white;
}

.el-aside {
  background-color: #ffffff;
  color: #333;
  text-align: center;
  border-width: 3px; /* 设置边框宽度为3像素 */
  border-color: blue; /* 设置边框颜色为蓝色 */
  border-style: solid; /* 设置边框样式为实线 */
  padding: 10px; /* 添加内边距 */
  height: 89vh;
}

.el-main {
  color: #333;
  text-align: center;
  border-width: 3px; /* 设置边框宽度为3像素 */
  border-color: blue; /* 设置边框颜色为蓝色 */
  border-left-color: white;
  border-style: solid; /* 设置边框样式为实线 */
  padding: 10px; /* 添加内边距 */
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.headMain{
  color: #ffffff; /* 设置字体颜色为红色 */
  font-size: 18px;
}
.center-text {
  /* 使用 margin-left 和 margin-right auto 来实现居中效果 */
  margin-left: auto;
  margin-right: auto;
  /* 注意：如果 header 内只有这两个元素，你可能不需要 margin-right: auto */
}

/*自定义样式*/
</style>